import Vue from "vue";
import VueRouter from "vue-router";

import Layout from "@/views/layout.vue";
import Login from "@/views/login.vue";
import Register from "@/views/register.vue";
import Detail from "@/views/detail";
import Enshrine from "@/views/enshrine";
import Houserent from "@/views/houserent.vue";
import Housing from "@/views/Housing.vue";
import City from "@/views/city.vue";
import Map from "@/views/map.vue";

import Article from "@/views/article.vue";
import Collect from "@/views/collect.vue";
import Like from "@/views/like.vue";
import User from "@/views/user.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    component: Login,
  },
  {
    path: "/article/:id",
    component: Detail,
  },
  {
    path: "/register",
    component: Register,
  },
  {
    path: "/enshrine",
    component: Enshrine,
  },
  {
    path: "/houserent",
    component: Houserent,
  },
  {
    path: "/housing",
    component: Housing,
  },
  {
    path: "/city",
    component: City,
  },
  {
    path: "/map",
    component: Map,
  },
  {
    path: "/",
    component: Layout,
    redirect: "/article",
    children: [
      { path: "/article", component: Article },
      { path: "/collect", component: Collect },
      { path: "/like", component: Like },
      { path: "/user", component: User },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
